UNAME := $(shell uname)

ifeq ($(UNAME), Linux)
all: build
endif

ifeq ($(UNAME), Darwin)
all: mac
endif

build:
	mvn clean package -DskipTests

mac: build
	rm -rf mircle/target/Mircle.app
	mkdir -p mircle/target/Mircle.app/Contents/MacOS
	mkdir -p mircle/target/Mircle.app/Contents/Resources/Java
	ln -s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub mircle/target/Mircle.app/Contents/MacOS/
	cp mircle/mac/Info.plist mircle/target/Mircle.app/Contents/
	cp mircle/target/mircle-*.jar mircle/target/Mircle.app/Contents/Resources/Java/mircle.jar
	cp -r mircle/target/natives mircle/target/Mircle.app/Contents/Resources/Java
